/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.StateVariables.impl;

import EA_Model.IEC61970.StateVariables.StateVariablesPackage;
import EA_Model.IEC61970.StateVariables.SvTapStep;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Sv Tap Step</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.StateVariables.impl.SvTapStepImpl#getContinuousPosition <em>Continuous Position</em>}</li>
 *   <li>{@link EA_Model.IEC61970.StateVariables.impl.SvTapStepImpl#getPosition <em>Position</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SvTapStepImpl extends StateVariableImpl implements SvTapStep {
	/**
	 * The cached value of the '{@link #getContinuousPosition() <em>Continuous Position</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getContinuousPosition()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float continuousPosition;

	/**
	 * The cached value of the '{@link #getPosition() <em>Position</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPosition()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Integer position;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SvTapStepImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return StateVariablesPackage.Literals.SV_TAP_STEP;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getContinuousPosition() {
		if (continuousPosition != null && continuousPosition.eIsProxy()) {
			InternalEObject oldContinuousPosition = (InternalEObject)continuousPosition;
			continuousPosition = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldContinuousPosition);
			if (continuousPosition != oldContinuousPosition) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, StateVariablesPackage.SV_TAP_STEP__CONTINUOUS_POSITION, oldContinuousPosition, continuousPosition));
			}
		}
		return continuousPosition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetContinuousPosition() {
		return continuousPosition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setContinuousPosition(EA_Model.IEC61970.Domain.Float newContinuousPosition) {
		EA_Model.IEC61970.Domain.Float oldContinuousPosition = continuousPosition;
		continuousPosition = newContinuousPosition;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, StateVariablesPackage.SV_TAP_STEP__CONTINUOUS_POSITION, oldContinuousPosition, continuousPosition));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Integer getPosition() {
		if (position != null && position.eIsProxy()) {
			InternalEObject oldPosition = (InternalEObject)position;
			position = (EA_Model.IEC61970.Domain.Integer)eResolveProxy(oldPosition);
			if (position != oldPosition) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, StateVariablesPackage.SV_TAP_STEP__POSITION, oldPosition, position));
			}
		}
		return position;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Integer basicGetPosition() {
		return position;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPosition(EA_Model.IEC61970.Domain.Integer newPosition) {
		EA_Model.IEC61970.Domain.Integer oldPosition = position;
		position = newPosition;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, StateVariablesPackage.SV_TAP_STEP__POSITION, oldPosition, position));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case StateVariablesPackage.SV_TAP_STEP__CONTINUOUS_POSITION:
				if (resolve) return getContinuousPosition();
				return basicGetContinuousPosition();
			case StateVariablesPackage.SV_TAP_STEP__POSITION:
				if (resolve) return getPosition();
				return basicGetPosition();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case StateVariablesPackage.SV_TAP_STEP__CONTINUOUS_POSITION:
				setContinuousPosition((EA_Model.IEC61970.Domain.Float)newValue);
				return;
			case StateVariablesPackage.SV_TAP_STEP__POSITION:
				setPosition((EA_Model.IEC61970.Domain.Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case StateVariablesPackage.SV_TAP_STEP__CONTINUOUS_POSITION:
				setContinuousPosition((EA_Model.IEC61970.Domain.Float)null);
				return;
			case StateVariablesPackage.SV_TAP_STEP__POSITION:
				setPosition((EA_Model.IEC61970.Domain.Integer)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case StateVariablesPackage.SV_TAP_STEP__CONTINUOUS_POSITION:
				return continuousPosition != null;
			case StateVariablesPackage.SV_TAP_STEP__POSITION:
				return position != null;
		}
		return super.eIsSet(featureID);
	}

} //SvTapStepImpl
